//
//  FenLeiViewController.m
//  Reading
//
//  Created by 军哥 on 15-1-27.
//  Copyright (c) 2015年 军哥. All rights reserved.
//

#import "FenLeiViewController.h"
#import "ReadingViewController.h"
#import "ReadDirectoryIViewController.h"
#import "FenleiCell.h"
#import "Fenlei2Cell.h"
@interface FenLeiViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation FenLeiViewController
- (void)dealloc
{
    [_tabel release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor cyanColor];
    self.title = @"分类阅读";
    
    
    self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"yinlehome.png"] style:UIBarButtonItemStyleDone target:self action:@selector(listionAction:)]autorelease];
    
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"jingxuan.png"] style:UIBarButtonItemStyleDone target:self action:@selector(JingXuanAction:)]autorelease];
    
    
    _tabel = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    _tabel.dataSource = self;
    _tabel.delegate = self;
    [self.view addSubview:_tabel];
    _tabel.tableFooterView = [[[UIView alloc]init] autorelease] ;
    self.tabel.separatorStyle = UITableViewCellAccessoryCheckmark;
    [_tabel release];
    
}
//音乐
-(void)listionAction:(UIBarButtonItem *)listion
{
    
}
//回到精选
-(void)JingXuanAction:(UIBarButtonItem *)listion
{
    ReadingViewController *red = [[ReadingViewController alloc]init];
    [self.navigationController pushViewController:red animated:NO];
    [red release];
    
}
//行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 6;
}
//cell的设置
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0||indexPath.row == 2||indexPath.row == 4) {
    
    static NSString *str = @"jun";
    FenleiCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if (cell == nil) {
        cell = [[[FenleiCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:str]autorelease];
        //选中有没有灰色
         cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
    }
        static NSString *str2 = @"junjun";
        Fenlei2Cell *cell2 = [tableView dequeueReusableCellWithIdentifier:str2];
        if (cell2 == nil) {
            cell2 = [[[Fenlei2Cell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:str2]autorelease];
             cell2.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        return cell2;
        
        
    }

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 180;
}
//点击调到分类目录
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ReadDirectoryIViewController *ReadDc = [[ReadDirectoryIViewController alloc]init];
    [self.navigationController pushViewController:ReadDc animated:YES];
    [ReadDc release];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
